<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@taglib uri="/WEB-INF/tld/pageutil.tld" prefix="pu"%>
<%@taglib uri="/WEB-INF/tld/pageable.tld" prefix="pageable"%>
<%@taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt-rt"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<%@	page import="com.yaodian100.core.common.utils.ServerValue"%>
<c-rt:set var="midContextPath" value='<%=ServerValue.getMidContextPath()%>'/>
<c-rt:set var="tp" value="${pu:pageableTag('tpp', 10, 10)}"/>
<c-rt:set var="hql">
from VirtualBalance where memberId = ? and type='G' and to_date(to_char(trxDate,'yyyy-MM-dd'),'yyyy-MM-dd') between ? and ? order by trxDate desc
</c-rt:set>
<c-rt:set var="params" value="${pu:addToList('paras', param.memberId)}"/>
<c-rt:set var="params" value="${pu:addToList('paras', pu:toDate(startDateParam,'yyyy-MM-dd'))}"/>
<c-rt:set var="params" value="${pu:addToList('paras', pu:toDate(endDateParam,'yyyy-MM-dd'))}"/>
<c-rt:set var="virtualBalance" value="${pu:queryByHql(hql, params, tp)}"/>

<s:actionerror />
<s:actionmessage />
<s:fielderror />
<!-- 月历 -->
<script type="text/javascript" charset="UTF-8"
	src="${midContextPath}/js/jquery.datepick.js"></script>
<script type="text/javascript" charset="UTF-8"
	src="${midContextPath}/js/jquery.datepick-zh-CN.js"></script>
<link rel="stylesheet" type="text/css"
	href="${midContextPath}/css/smoothness.datepick.css" />
<script language="javascript">
$().ready( function() {
	$('#startDateParam').datepick({minDate: null, maxDate: new Date(), showOn: 'both', 
    	buttonImageOnly: true, buttonImage: '/images/calendar.gif',dateFormat:"yy-mm-dd",yearRange: '-3:+3'}); 
	$('#endDateParam').datepick({minDate: null, maxDate: new Date(), showOn: 'both', 
    	buttonImageOnly: true, buttonImage: '/images/calendar.gif',dateFormat:"yy-mm-dd",yearRange: '-3:+3'}); 
	$('#sendData').click(function(){
		doAR('${midContextPath}/member/searchGiftcardList.do?AJAX=true&refreshZone=tabs-10', 'tabs-10', 'virtualBalanceForm');
		//doAR('/admin/member/searchVirtualBalance.do?AJAX=true&refreshZone=tabs-8&memberId=${param.memberId}&startDateParam=${param.startDate}&endDateParam=${param.endDate}','tabs-8');
	});
});
</script>
<div class="data-form">
<s:form name="virtualBalanceForm" method="post">
	<b>日期区间：</b>
	<input name="startDateParam" type="text" id="startDateParam"
		value="${startDateParam}" size="10" maxlength="10">
    ~ 
  <input name="endDateParam" type="text" id="endDateParam"
		value="${endDateParam}" size="10" maxlength="10">
	<input type="hidden" name="memberId" value="${memberId}"/>
	<input type="button" id="sendData" value="搜寻"/>
</s:form>
</div>
<table class="tb-1" width="100%">
	<thead>
		<tr>
			<th>交易日期</th>
			<th>说明</th>
			<th>金额</th>
			<th>馀额</th>
		</tr>
	</thead>
	<tbody>
		<c-rt:forEach items="${virtualBalance}" var="virtualBalance" varStatus="rows_index">
			<tr class="${rows_index.count % 2 == 0 ? 'bg-yl' : ''}">
				<td><fmt-rt:formatDate value="${virtualBalance.trxDate}" pattern="yyyy-MM-dd HH:mm:ss" /></td>
				<td>${virtualBalance.description}</td>
				<td>${virtualBalance.trxAmount}</td>
				<td>${virtualBalance.summaryAmount}</td>
			</tr>
		</c-rt:forEach>
	</tbody>
</table>
<pageable:Pageable url="${midContextPath}/member/searchGiftcardList.do" escapeparams="AJAX,refreshZone" parameter="AJAX=true&refreshZone=tabs-10" formname="NewVirtualBalanceForm" key="tpp"></pageable:Pageable>